package c.main.jdbc;

import org.apache.log4j.Logger;

import javax.sql.DataSource;
import java.util.List;
import java.util.Map;

/**
 * Author: chengwei
 * Date:   2016/3/23
 * Time:   16:46
 */
public interface JdbcTemplate {
    
    Logger log = Logger.getLogger(JdbcTemplate.class);

    DataSource getDataSource();
    
    void setAutoCommit(boolean b);
    
    void open();
    
    void commit();
    
    void close();

    void rollback();
    
    int executeInsert(String tableName,Map<String,Object> map);

    int executeUpdate(String tableName,Map<String,Object> where,Map<String,Object> set);

    int executeDelete(String tableName,Map<String,Object> where);

    int execute(String sql,Object... args);

    Map<String,Object> queryForMap(String sql, Object... args);

    List<Map<String,Object>> queryForListMap(String sql, Object... args);

    int queryForInt(String sql, Object... args);
}
